﻿<Window x:Class="WpfPdfReader.WindowBookManager"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="书签管理" Height="600" Width="800" Background="{StaticResource winBackground}" WindowStyle="ThreeDBorderWindow" WindowStartupLocation="CenterScreen">
    <Grid Background="Transparent">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="240"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Grid Grid.Column="0">
            <ListBox  Background="Transparent" Name="listBox" Grid.Column="0" ItemsSource="{Binding BookMarks}" SelectionChanged="listBox_SelectionChanged">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <TextBlock DockPanel.Dock="Left" VerticalAlignment="Center" FontFamily="Arial" FontSize="16" Text="{Binding Name}" />
                    </DataTemplate>
                </ListBox.ItemTemplate>
                <ListBox.Resources>
                    <RoutedUICommand x:Key="GotoCommand"/>
                    <RoutedUICommand x:Key="DeleteCommand"/>
                </ListBox.Resources>
                <ListBox.CommandBindings>
                    <CommandBinding Command="{StaticResource GotoCommand}" CanExecute="CanGotoCommand" Executed="Goto"/>
                    <CommandBinding Command="{StaticResource DeleteCommand}" CanExecute="CanDeleteCommand" Executed="Delete"/>
                </ListBox.CommandBindings>
                <ListBox.ContextMenu>
                    <ContextMenu Name="contextMenu" >
                        <MenuItem Header="转到" Name="menuGoto" Command="{StaticResource GotoCommand}" >
                            <MenuItem.Icon>
                                <Image Source="Images/Goto.png" Width="16" Height="16"/>
                            </MenuItem.Icon>
                        </MenuItem>
                        <MenuItem Header="删除" Name="menuDelete" Command="{StaticResource DeleteCommand}">
                            <MenuItem.Icon>
                                <Image Source="Images/Delete.png" Width="16" Height="16"/>
                            </MenuItem.Icon>
                        </MenuItem>
                    </ContextMenu>
                </ListBox.ContextMenu>
            </ListBox>
        </Grid>

        <GridSplitter Width="1" Background="LightGray"/>

        <DockPanel Grid.Column="1" LastChildFill="True">
            <Border DockPanel.Dock="Top" BorderBrush="LightGray" BorderThickness="1" Margin="3">
                <DockPanel DockPanel.Dock="Top" LastChildFill="True">
                    <TextBlock Text="读书笔记:" FontFamily="Arial" FontSize="16" Foreground="White"/>
                    <StackPanel Width="100" DockPanel.Dock="Right">
                        <Label Style="{StaticResource ButtonLabelStyle}"  Content="修改" Name="btnModify" IsEnabled="False" MouseUp ="btnModify_Click"/>
                        <Label Style="{StaticResource ButtonLabelStyle}" Content="保存" Name="btnSave" IsEnabled="False" MouseUp="btnSave_Click"/>
                    </StackPanel>
                    <TextBox TextWrapping="Wrap" AcceptsReturn="True" BorderThickness="1,0,1,0" IsReadOnly="True" Name="note" FontFamily="Arial" FontSize="16" Height="120" Text="{Binding Note}" Background="Transparent" Foreground="White" TextChanged="note_TextChanged"/>
                </DockPanel>
            </Border>
            <Border BorderBrush="LightGray" BorderThickness="1" Margin="3">
                <Image Name="image" Margin="3" Grid.Column="1" Stretch="Uniform" RenderOptions.BitmapScalingMode="NearestNeighbor" MouseUp="image_MouseUp"/>
            </Border>
        </DockPanel>
    </Grid>
</Window>
